package com.example.zhu.service.Impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.example.zhu.entity.Users;
import com.example.zhu.mapper.UsersMapper;
import com.example.zhu.service.UsersService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class UsersServiceImpl extends ServiceImpl<UsersMapper, Users> implements UsersService {
    @Autowired
    private UsersMapper usersMapper;
    @Override
    public List<Users> selectAll() {
        List<Users> users = usersMapper.selectList(null);
        return users;
    }

    @Override
    public void updateUser(Integer id) {
        Users user = usersMapper.selectById(id);
        if(user.getType()==0){
            user.setType(1);
        }else{
            user.setType(0);
        }
        usersMapper.updateById(user);
    }

}
